
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
/*import org.junit.*;
import org.junit.runners.Parameterized.Parameters;
*/
import org.testng.annotations.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.safari.SafariDriver;

import com.opera.core.systems.OperaDriver;

public class Differentbrowsers {
	
	@Parameters ({ "FF" })
	
	@Test
	public void setup(String BROWSER) throws InterruptedException{
		//WebDriver driver=null;  
	System.out.println("Browser: " + BROWSER);

	if (BROWSER.equalsIgnoreCase("FF")) 
	{
	System.out.println("FF is selected");
	FirefoxDriver driver = new FirefoxDriver();
	} 
	else if (BROWSER.equalsIgnoreCase("Chrome"))
	{
	System.out.println("Google chrome is selected");
	System.setProperty("webdriver.chrome.driver", "E:\\Automation Software tools\\selenium jars\\chromedriver.exe");
	ChromeDriver driver = new ChromeDriver();
	}
	else if (BROWSER.equalsIgnoreCase("IE")) 
	{
	System.out.println("IE is selected");
	System.setProperty("webdriver.ie.driver", "E:\\Automation Software tools\\selenium jars\\IEDriverServer.exe");
	InternetExplorerDriver driver = new InternetExplorerDriver();
	} 
	else if (BROWSER.equalsIgnoreCase("Safari"))
	{
	System.out.println("Safari browser is selected");
	SafariDriver driver = new SafariDriver();
	}
	else if (BROWSER.equalsIgnoreCase("HU"))
	{
	System.out.println("HU is selected");
	HtmlUnitDriver driver = new HtmlUnitDriver();
	}
	else if (BROWSER.equalsIgnoreCase("Opera"))
	{
	System.out.println("Opera browser is selected");
	OperaDriver driver = new OperaDriver();
	}
	//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
	
	String vURL = "http://www.pennywisesolutions.com";
	//driver.get(vURL);  
	
	//List<WebElement> imagesList = driver.findElements(By.tagName("img"));
		int countBrokenImages = 0;
		//for (WebElement image : imagesList)
		{
	//	    HttpResponse response = new DefaultHttpClient().execute(new HttpGet(image.getAttribute("src")));
		//    if (response.getStatusLine().getStatusCode() != 200){
		        // Do whatever you want with broken images
		 //   	String  currentImageUrl = image.getAttribute("src");
		   // 	System.out.println(currentImageUrl);
		    	countBrokenImages++;
		    }
		}	
		//System.out.println("The number of Broken URLs are: " + countBrokenImages);
}
	
//	}